var message = 60;
console.log(message);
class Site {
    name() {
        console.log("Runoob");
    }
}
var obj = new Site();
obj.name();
let x; //严格空校验下的规范
x = null;
function add2(x, y) {
    return x + y;
}
console.log(add2(1, 2));
function buildName(firstName, lastName) {
    if (lastName)
        return firstName + " " + lastName;
    else
        return firstName;
}
function calculate_discount(price, rate = 0.50) {
    var discount = price * rate;
    console.log("计算结果: ", discount);
}
function addNumbers(...nums) {
    var i;
    var sum = 0;
    for (i = 0; i < nums.length; i++) {
        sum = sum + nums[i];
    }
    console.log("和为：", sum);
}
addNumbers(1, 2, 3);
addNumbers(10, 10, 10, 10, 10);
var res = function (a, b) {
    return a * b;
};
console.log(res(12, 2));
var myFunction = new Function("a", "b", "return a * b"); //构造函数
var x1 = myFunction(4, 3);
console.log(x1);
function factorial(number) {
    if (number <= 0) { // 停止执行
        return 1;
    }
    else {
        return (number * factorial(number - 1)); // 调用自身
    }
}
;
console.log(factorial(6)); // 输出 720
var foo = (x) => 10 + x; //箭头函数 单个参数要限制类型的话要加()
console.log(foo(100)); //输出结果为 110
function disp(x, y) {
    console.log(x);
    console.log(y);
}
disp("abc");
disp(1, "xyz");
console.log("TypeScript Number 属性: ");
console.log("最大值为: " + Number.MAX_VALUE);
console.log("最小值为: " + Number.MIN_VALUE);
console.log("负无穷大: " + Number.NEGATIVE_INFINITY);
console.log("正无穷大:" + Number.POSITIVE_INFINITY);
console.log(Number.NaN);
//ts里所有的规范和报错在编译后都会变得没有意义，但是在编译前的代码在非自己的写的代码下可读性可高
//变量不要使用 name 否则会与 DOM 中的全局 window 对象下的 name 属性出现了重名
